package com.example.pcmintuidemo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;

import androidx.annotation.Nullable;

public class MyRankingActivity extends Activity {

    private WebView webView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent intent = getIntent();
        String thisUrl = intent.getStringExtra("thisUrl");
        String nextUrl = intent.getStringExtra("nextUrl");
        int userId = intent.getIntExtra("userId",0);
        String param = "thisUrl="+thisUrl+"&nextUrl="+nextUrl+"&userId="+userId;
        setContentView(R.layout.my_ranking);
        webView = findViewById(R.id.webView);

        WebSettings webSettings = webView.getSettings();
        webView.getSettings().setSupportZoom(true);
        webSettings.setBuiltInZoomControls(true);
        webSettings.setUseWideViewPort(true);
        webSettings.setLoadWithOverviewMode(true);
        webSettings.setDefaultTextEncodingName("utf-8");
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
        webView.requestFocus();

        webView.loadUrl("http://192.168.22.22:8601/smart_express_vue/#/myRanking?"+param);
        webView.setWebViewClient(new MyRankingWebViewClient(MyRankingActivity.this));
    }
}
